package com.pexper.ingoal.view.activity;

import com.pexper.ingoal.view.R;
import com.pexper.ingoal.view.transaction.Transacao;
import com.pexper.ingoal.view.transaction.TransacaoTask;
import com.pexper.ingoal.view.utils.AndroidUtils;

import android.app.Activity;

public class BaseActivity extends Activity {
	
	protected void alert(int mensagem) {
		AndroidUtils.alertDialog(this, mensagem);
	}
	
	// inicia a thread
	public void startTransacao(Transacao transacao) {
		boolean redeOK = AndroidUtils.isNetworkAvailable(this);
		if (redeOK) {
			// inicia a transacao
			TransacaoTask task = new TransacaoTask(this, transacao, R.string.aguarde);
			task.execute();
		} else {
			// nao existe contexao
			AndroidUtils.alertDialog(this, R.string.erro_conexao_indisponivel);			
		}
	}

}
